package com.company;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
//这个是设置完端口转发后，直接进行测试的APP
//adb -s device_id forward tcp:host_port tcp:server_port

public class Main {

    public static void main(String[] args) throws IOException {
        // write your code here
        System.out.println("Hello World");

        int host_port = 35000;
        Socket device_hostsocket = new Socket("localhost", host_port);
        DataInputStream dataInputStream = new DataInputStream(device_hostsocket.getInputStream());
        DataOutputStream dataOutputStream = new DataOutputStream(device_hostsocket.getOutputStream());
        String msg = dataInputStream.readUTF();
        System.out.println(msg);
        dataOutputStream.writeUTF("猪娃: 你好，安卓");
        dataOutputStream.flush();
        dataOutputStream.close();
        dataInputStream.close();
    }
}
